<template>
	<view>
		<view v-if="data" class="cards">
			<view class="lists" @click="info(data)">
				<view class="lists-item">
					<view class="title">
						<text>统计</text>
					</view>
				</view>
				<view class="lists-item">
					<view class="items">
						当月新增(人)
					</view>
					<view class="items total">
						{{data.month_total}}
					</view>
				</view>
				<view class="lists-item">
					<view class="items">
						累计(人)
					</view>
					<view class="items total">
						{{data.all_total}}
					</view>
				</view>
			</view>
		</view>
		<u-empty v-else mode="list" icon="/static/Empty/data_null.png">
		</u-empty>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: {},
				type: 1,
				top_title: '我的直营'
			}
		},
		onLoad(e) {
			this.type = e.type
			if (this.type == 2) {
				this.top_title = '团队'
			} else {
				this.top_title = '我的直营'
			}
			uni.setNavigationBarTitle({
				title: this.top_title
			})
			this.loadData()
		},
		methods: {
			async loadData() {
				uni.showLoading({
					title: '加载中'
				});
				const {
					data: res
				} = await this.$myHttp({
					url: 'Datas/getProductTeam',
					data: {
						type: this.type
					}
				});
				uni.hideLoading()
				if (res.code == 200) {
					this.data = res.data
				}
			},
			info(e) {
				if (this.type == 1){
					uni.navigateTo({
						url: '/pages/data/team/team?product_id=' + e.id
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.cards {
		padding: 30rpx;

		.lists {
			box-sizing: border-box;
			margin-bottom: 15px;
			border-radius: 7px;
			box-shadow: 7px 5px 30px -18px #888888;

			.lists-item {
				padding: 30rpx;
				display: flex;
				border-bottom: 1px solid #eee;
				align-items: center;
				justify-content: space-between;

				.title {
					text {
						font-size: 30rpx;
						font-weight: bold;
						padding-left: 10rpx;
						border-left: 4px solid #2f9fff;
						border-top-left-radius: 6rpx;
						border-top-right-radius: 6rpx;
						border-bottom-left-radius: 6rpx;
						border-bottom-right-radius: 6rpx;
					}
				}
				
				.items {
					font-size: 28rpx;
					color: #999;
				}
				
				.total {
					font-weight: bold;
					color: #1296db;
				}
			}
		}
	}
</style>